﻿using BepInEx;
using System;
using UnityEngine;
using HarmonyLib;
using UnityEngine.UI;
using System.Reflection;
using System.Threading;
using System.Collections.Generic;
using System.Linq;

namespace tiandiguixu.foring
{

    /// <summary>
    /// 如果有坑的话
    /// 每回合保持一个神庙，道观
    /// </summary>
    public partial class ForingMod
    {



        //public static void RefreshSacrifice(GlobalController __instance)
        //{
        //    if (!refreshSacrifice) return;
        //    const string location = "21";//家旁边的位置 

        //    var keys = BuildingManager.Instance.Dic_Areas_SmallNode[Areas.云梦];
        //    Node node = NodeManager.Instance.Dic_Id_Node.Where(i => i.Key == location).Select(i => i.Value).FirstOrDefault();
        //    if (node == null)
        //    {
        //        instance.Logger.LogInfo("云梦 21 已有建筑，不用刷新");
        //        return;
        //    }

        //    if (node.building == null)
        //    {
        //        instance.Logger.LogInfo("云梦 21 刷新 祭祀");
        //        List<BuildingInfo> list = AllDictionary.Dic_BuildingInfo.Values.ToList<BuildingInfo>().FindAll((BuildingInfo b) => b.area == Areas.云梦.ToString() && b.IsGood == true && !b.IsBigBuilding);
        //        list.AddRange(AllDictionary.Dic_BuildingInfo.Values.ToList<BuildingInfo>().FindAll((BuildingInfo b) => b.area == "通用" && b.IsGood == true && !b.IsBigBuilding));
        //        var buildingInfo = list.FirstOrDefault(i => i.buildingType == Building.Type.祭祀);
        //        if (buildingInfo != null)
        //        {
        //            Sacrifice sacrifice = new Sacrifice();
        //            string str3 = "SS_";
        //            double smallBuildingCount3 = BuildingManager.SmallBuildingCount;
        //            BuildingManager.SmallBuildingCount = smallBuildingCount3 + 1.0;
        //            double num = smallBuildingCount3;
        //            sacrifice.id = str3 + num.ToString();
        //            sacrifice.nodeId = node.id;
        //            sacrifice.duration = buildingInfo.duration;
        //            Sacrifice sacrifice2 = sacrifice;
        //            if (UnityEngine.Random.Range(0, 2) == 0)
        //            {
        //                sacrifice2.type = Sacrifice.Type.神庙;
        //            }
        //            else
        //            {
        //                sacrifice2.type = Sacrifice.Type.道观;
        //            }
        //            sacrifice2.name = sacrifice2.type.ToString();
        //            BuildingManager.Instance.LoadBuildingSprite(sacrifice2, node);
        //            WholeObjects.Instance.Dic_Sacrifice.Add(sacrifice2.id, sacrifice2);
        //            sacrifice2.Start();
        //        }
        //    }  
        //}
    }
}
